The present disclosure relates in general to executing computer instructions that access, read, write and/or load stored data. More specifically, the present disclosure relates to executing computer instructions that limit the access violation reporting that can occur when attempting to access data that span across a memory boundary.
Null-terminated strings are often used in C and other programming languages. A null-terminated string is a contiguous sequence of characters (or elements, or bytes), wherein the last character in the string is a null character (typically a “0” value) that indicates the end of the string. Because an application does not know the actual size or location of a C-style null-terminated string, the application typically accesses, reads and loads null-terminated strings by sequentially accessing, reading and loading individual string characters until a null character is reached.
Memory may be organized into blocks. A single block or page of memory typically shares a common set of address translations and access permissions. Access permissions determine whether an application has privileges to read or write the contents of a memory page. A null-terminated string may be located at any arbitrary address within a memory page, including for example, near the end of a page, spanning a boundary that separates two different pages, or extending up to the end of a page without crossing the page boundary. An application attempting to access a null-terminated string that spans a page boundary must have access permissions for both pages. If the application has access to the first page but not the second page, a page access violation occurs when the application attempts to access the portion of the string located in the second page. In order to protect system integrity, operating systems are typically strict in not allowing applications to access to a page without having the proper access permission. Thus, operating systems typically kill the offending application in response to a page access violation.
Single instruction multiple data (SIMD) processing is a performance enhancement feature that allows one instruction to operate on multiple data items at the same time. Thus, SIMD allows what usually requires a repeated succession of instructions (e.g., a loop) to be performed in one instruction. For a number of string data functions such as a comparison of two different strings or a string copy operation, SIMD has the potential to reduce processing time by processing multiple string characters in parallel. However, much of this reduced processing time is offset by the additional software overhead that is needed in order to avoid the above-described page access violations that would occur if an application attempts a parallel data access and load (e.g., an SIMD load) of data that cross a memory page boundary, wherein the application does not have access privileges to the pages on both sides of the boundary.